package com.gzyz.cheetah.interceptor;

import com.gzyz.cheetah.util.ThreadLocalUtil;
import org.springframework.web.servlet.HandlerInterceptor;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * 自定义拦截器都继承该抽象拦截器
 *
 * @author xclhove
 */
public abstract class AbstractInterceptor implements HandlerInterceptor {
    @Override
    public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
        //释放ThreadLocal的内存防止内存泄漏
        ThreadLocalUtil.remove();
    }
}